﻿using Models.DataModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Models.DataStore
{
    public class ContributionFundAllocationEx : ContributionFundAllocation {
        public string FundCode { get; set; }
    }
    public partial class Ctrl : Core
    {
        public List<ContributionFundAllocationEx> GetListContributionFundAllocation(Guid id)
        {
            return (
                    from con in db.ContributionFundAllocations
                    join fund in db.Funds on con.FundId equals fund.FundId
                    where con.ContributionId == id
                    select new ContributionFundAllocationEx { 
                        FundCode=fund.Code,
                        Rate=con.Rate,
                        Percentage=con.Percentage,
                        Amount=con.Amount
                    }
                ).ToList();
        }
    }
}
